Những câu hỏi liên quan
Hoàng Trần Thanh Hà _THP...
Xem chi tiết
gấu béo
26 tháng 3 2023 lúc 22:35

n = int(input("Nhập n: "))

a = [ ]

for i in range(n):

     a.append(int(input(f"Nhập phần tử a[{i}]: ")))

k = int(input("Nhập k: "))

count_greater = 0

count_divisible_by_three = 0

for num in a:

     if num > k:

          count_greater += 1

     if sum(int(digit) for digit in str(num)) % 3 == 0:

          count_divisible_by_three += 1

print(f"Số lớn hơn {k}: {count_greater} số")

print(f"Số có tổng các chữ số chia hết cho 3: {count_divisible_by_three} số")

Bình luận (0)
Thảo Nguyên Ngô
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 12 2021 lúc 23:17

a:

#include <bits/stdc++.h>

using namespace std;

long long n,i,a[10000];

int main()

{

cin>>n;

for (i=1;i<=n; i++)

cin>>a[i];

for (i=1; i<=n; i++)

cout<<a[i]<<" ";

return 0;

}

Bình luận (0)
Hà Văn Tài
Xem chi tiết
Kiều Vũ Linh
18 tháng 4 2022 lúc 11:08

var a:array [1..100] of integer;

i,n,dem:integer;

begin

write('Nhap so luong so N = ');readln(n);

for i:=1 to n do

begin

write('Nhap vao so thu ',i,': ');readln(a[i]);

if a[i] mod 3 = 0 then dem:=dem+1;

end;

write('Co ',dem,' so chia het cho 3');

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
18 tháng 4 2022 lúc 11:05

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n,dem;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

dem=0;

for (i=1; i<=n; i++)

if (a[i]%3==0) dem++;

cout<<dem;

return 0;

}

Bình luận (0)
Nga Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 10 2021 lúc 23:44

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t,dem;

int main()

{

cin>>n;

t=0;

dem=0;

for (i=1; i<=n; i++)

{

cin>>x;

if (x<5) 

{

t=t+x;

dem++;

}

}

cout<<t<<" "<<dem;

return 0;

}

Bình luận (0)
Mai Võ
29 tháng 10 2021 lúc 8:31

undefined

Bình luận (0)
Ngọc Thanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
16 tháng 11 2021 lúc 23:41

d: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=0;

for (i=1; i<=n; i++)

s=s+i;

cout<<s;

return 0;

}

Bình luận (0)
fyujg
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 2 2021 lúc 13:08

uses crt;

var a:array[1..100]of integer;

i,n,dem,k:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

write('Nhap k='); readln(k);

dem:=0;

for i:=1 to n do 

  if a[i]=k then inc(dem);

writeln('Trong day co ',dem,' phan tu co gia tri bang ',k);

readln;

end.

Bình luận (1)
Dương Thành Long
Xem chi tiết
Đỗ Tuệ Lâm
24 tháng 2 2022 lúc 11:28

bạn tham khảo:

undefined

Bình luận (0)
Eliette
Xem chi tiết
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 22:51

Câu 1: 

uses crt;

var a:array[1..100]of integer;

i,n,t,s:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

s:=1;

dem:=0;

for i:=1 to n do 

  if a[i] mod 3=0 then 

begin

inc(dem);

t:=t+a[i];

s:=s*a[i];

end;

if dem=0 then writeln('Khong co so chia het cho 3 trong day')

else begin

writeln('Tong cac so chia het cho 3 la: ',t);

writeln('Tich cac so chia het cho 3 la: ',s);

end;

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 22:51

Câu 2: 

uses crt;

var a:array[1..100]of integer;

i,n,dem,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

dem:=0;

t:=0;

for i:=1 to n do 

 if a[i] mod 2=0 then 

begin

inc(dem);

t:=t+a[i];

end;

writeln('So so chan la: ',dem);

writeln('Tong cac so chan la: ',t);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 22:55

Câu 3: 

uses crt;

var a:array[1..100]of integer;

i,n,dem1,dem2,t1,t2,s1,s2:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

dem1:=0;

dem2:=0;

t1:=0;

t2:=0;

s1:=1;

s2:=1;

for i:=1 to n do

begin

if a[i] mod 2=0 then 

begin

inc(dem1);

t1:=t1+a[i];

s1:=s1*a[i];

end

else begin

inc(dem2);

t2:=t2+a[i];

s2:=s2*a[i];

end;

end;

if dem1=0 then writeln('Khong co so chan trong day')

else begin

writeln('So so chan la: ',dem1);

writeln('Tong cac so chan la: ',t1);

writeln('Tich cac so chan la: ',s1);

end;

if dem2=0 then writeln('Khong co so le trong day')

else begin

writeln('So so le la: ',dem2);

writeln('Tong cac so le la: ',t2);

writeln('Tich cac so le la: ',s2);

end;

readln;

end.

Bình luận (0)
shushu333
Xem chi tiết
Nguyên Hưng Trần
25 tháng 10 2021 lúc 21:19

program Tin_hoc;

Uses crt;

var i,n,k,dem:integer;

     a;array[1..10000] of integer;

Begin

clrscr;

write('Nhap n: ');readln(n);

writeln('Nhap ',n,' pha tu cua day A:');

for i:= 1 to n do readln(a[i]);

dem:=0;

write('Nhap k: ');readln(k);

for i:= 1 to n do if a[i] = k then inc(dem);

writeln('Day A co ',dem,' ki tu ',k,);

readln;

end.

Bình luận (0)